<?php $this->load->view(TEMPLATE_NAME.'/front/header'); ?>
<?php $this->load->view(TEMPLATE_NAME.'/front/side_left'); ?>
<script type="text/javascript">
function submitfrm()
{
	document.getElementById('dropdownform').submit();
}

function perpagefunction(perpagevalue)
{
	document.getElementById('perpage').value = perpagevalue;
	document.getElementById('dropdownform').submit();
	
}

function showhide()
{

	document.getElementById('showoptions').style.display = "block";
}

function hidefunction()
{
	document.getElementById('showoptions').style.display = "none";
}
</script>
<div class="page">
<h2><?php echo $network_name ?> - News <a href="<?php echo site_url('news/news_visibility/')?>">Post News</a></h2>

<!--<div class="clear"></div>-->
<!--<div>-->	<!--selection criterias -->
<?php    
$attributes = array("id"=> 'dropdownform');
echo form_open('news/network_news/'.$networkid,$attributes);
$js = 'onChange="submitfrm()"'; 
?>
<div class="localnews localnews2"> Order 
<?php
$selectionarray = array('1' => 'Newest to oldest',
						'2' => 'Most commented',
						'3' => 'Most Read',
						'4' => 'Most Liked',
						'5' => 'Oldest to Newest');
 echo form_dropdown('selection_criteria',$selectionarray,$dropdown_id,$js);
?>
<input type="hidden" name="perpage" id="perpage" value="<?php echo ($perpage == "" ? '15' : $perpage) ?>" />
<!--<span>Display  <a href="javascript:;" onclick="perpagefunction('15')" <?php if($perpage == '15') { ?>class="on" <?php } ?> >15</a> <a href="javascript:;" onclick="perpagefunction('20')" <?php if($perpage == '20') { ?>class="on" <?php } ?>>20</a>  <a href="javascript:;" onclick="perpagefunction('30')" <?php if($perpage == '30') { ?>class="on" <?php } ?>>30</a> items per page</span>-->  
<div class="r purple f13"><a href="javascript:;" onclick="showhide()">Options <img src="<?php echo base_url()?>xhtml/img/down.png" width="10" height="7" /></a></div>
<!--<div style="display:none" id="showoptions">
	<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>
    	<td style="width:100px" class="purple">Display Options:</td><td><?php echo form_checkbox('crimealert', '2', FALSE); ?>&nbsp;<strong>Display crime alerts in news feed</strong></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td style="text-align:center"><?php echo form_submit('submitopt', 'Submit'); ?>&nbsp;&nbsp;<span class="purple"><a href="javascript:;" onclick="hidefunction()">Close Panel</a></span></td>
    </tr>
    
    </table>
</div> -->
<div class="option" id="showoptions" style="display:none">
<hr />
<label>Display Options:</label>
<!--<p><input type="checkbox" /> Display Twitter Tweets in Alerts</p>-->
<p><?php echo form_checkbox('crimealert', '2', FALSE); ?> Display Crime Alerts in News Feed</p>
<span class="clear"></span>
<hr />
<?php echo form_submit('submitopt', 'Submit'); ?>
<a class="r" href="javascript:;" onclick="hidefunction()">Close Panel</a>
</div><!-- option -->
<?php echo form_close(); ?> 
</div>		
<!--<div class="clear"></div> -->
<!--<div id="message">-->
<ol class="realtime"> 
<?php if (!empty($list_news)){         // get news listing
foreach($list_news as $row){
	$comment_count = $this->News_model->get_comment_count($row['id']);	
?>
<!--<div style="float:left; width:50px ">-->
<?php
$user_info = $this->News_model->get_user_avator($row['user_id']);		//Get user avator
if(!empty($row['article_heading'])){ 
//Please remove static if the image is not showing.
?><li>
<!--<img src="<?php echo base_url();?>static/uploads/directory/photo<?php echo $user_info[0]['avatar'] ?> " width="63" height="60" alt="image">-->
<?php if((!empty($user_info[0]['avatar'])) && (file_exists("./uploads/profile/thumb/".$user_info[0]['avatar']))){?>
    <a href="<?php echo site_url('/news/news_article/'.$row['news_id'].'/'.str_replace(" ","-",$row['article_heading']).'/') ?>"><img src="<?php echo base_url();?>uploads/profile/thumb/<?php echo $user_info[0]['avatar'] ?> " width="52" height="52" alt="image"></a>
<?php } else {?> 
    <a href="<?php echo site_url('/news/news_article/'.$row['news_id'].'/'.str_replace(" ","-",$row['article_heading']).'/') ?>"><img height="52" width="52" src="<?php echo base_url(); ?>xhtml/img/badut.gif"/></a>
<?php }?>
<!--</div>-->
<!--<div style="float:left">-->
<!--<strong>--><!--<a href="<?php echo site_url('/news/news_article/'.$row['news_id'].'/'.str_replace(" ","-",$row['article_heading']).'/') ?>">-->
<?php echo $row['article_heading'] ?> <!--</a>--> <!--</strong>--><br />
<span class="purple">
<a href="<?php echo site_url('/news/news_article/'.$row['news_id'].'/'.str_replace(" ","-",$row['article_heading']).'/') ?>">....Read More </a> | 
Posted on <?php echo $row['created_date'] ?> | <!--<strong>--><?php echo $comment_count ?> Comments <!--</strong>-->| 
<!--<strong>-->0 Likes<!--</strong>--> | <!--<strong>-->Read 0 times<!--</strong>--> </span>
<!--</div>
<div class="clear"></div>--></li>
<?php
}
}
} else { ?>
<!--<div>--><li>No News</li><!--</div>-->
<?php
}
?>
<!--</div> --></ol>
<div class="prevnext">
<?php //echo $this->pagination->create_links(); ?>
</div>
<div class="clear"></div>
    <?php $this->load->view(TEMPLATE_NAME.'/front/footer_menu');?>
</div><!-- page -->

<?php $this->load->view(TEMPLATE_NAME.'/front/side_right');?> 
<?php $this->load->view(TEMPLATE_NAME.'/front/footer');?> 
